#include "creature.h"
#include "monde.h"

#include <QtCore/QDebug>

Creature::Creature() {
    m_age = 0;
}

Creature::Creature(Monde *pMonde) {
    m_age = 0;
    m_monde = pMonde;
}

Creature::Creature(Creature* p1, Creature* p2) {
    m_age = 0;
    m_monde = p1->m_monde;
    m_ageMax = ((p1->m_ageMax + p2->m_ageMax) / 2) + m_monde->m_incParMut;
}

void Creature::tour() {
    m_age++;

    if (m_age >= m_ageMax)
        mort();
}

void Creature::mort() {
    m_monde->m_listeCreatures.removeOne(this);
    delete this;
}
